home *** CD-ROM | disk | FTP | other *** search
- /* Copyright (C) 2001 jay@realfantasy.demon.co.uk
- This is free software distributed under the terms of the
- GNU Public License. See the file COPYING for details. */
-
- /* Additional inlines for opennap-0.41 to allow bsdsocket.library access to
- a few functions not emulated by ixemul */
-
- #ifndef _CDEFS_H_
- #include <sys/cdefs.h>
- #endif
-
- __BEGIN_DECLS
-
- #ifndef BASE_EXT_DECL
- #define BASE_EXT_DECL
- #define BASE_EXT_DECL0 extern struct Library * SocketBase;
- #endif
- #ifndef BASE_PAR_DECL
- #define BASE_PAR_DECL
- #define BASE_PAR_DECL0 void
- #endif
- #ifndef BASE_NAME
- #define BASE_NAME SocketBase
- #endif
-
- BASE_EXT_DECL0
-
- extern __inline char *
- Inet_NtoA (BASE_PAR_DECL unsigned long in)
- {
- BASE_EXT_DECL
- register char * res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register unsigned long d0 __asm("d0") = in;
- __asm __volatile ("jsr a6@(-0xae)"
- : "=r" (res)
- : "r" (a6), "r" (d0)
- : "d0", "d1", "a0", "a1");
- return res;
- }
- extern __inline struct hostent *
- gethostbyname (BASE_PAR_DECL char * name)
- {
- BASE_EXT_DECL
- register struct hostent * res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register char * a0 __asm("a0") = name;
- __asm __volatile ("jsr a6@(-0xd2)"
- : "=r" (res)
- : "r" (a6), "r" (a0)
- : "d0", "d1", "a0", "a1");
- return res;
- }
- extern __inline unsigned long
- inet_addr (BASE_PAR_DECL const char * cp)
- {
- BASE_EXT_DECL
- register res __asm("d0");
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register const char * a0 __asm("a0") = cp;
- __asm __volatile ("jsr a6@(-0xb4)"
- : "=r" (res)
- : "r" (a6), "r" (a0)
- : "d0", "d1", "a0", "a1");
- return res;
- }
-
- extern __inline char *
- inet_ntoa(BASE_PAR_DECL struct in_addr addr)
- {
- return Inet_NtoA(addr.s_addr);
- }
-
- extern __inline void
- vsyslog (BASE_PAR_DECL int level, const char * format, va_list ap)
- {
- BASE_EXT_DECL
- register struct Library *a6 __asm("a6") = BASE_NAME;
- register unsigned long d0 __asm("d0") = level;
- register const char * a0 __asm("a0") = format;
- register long * a1 __asm("a1") = ap;
- __asm __volatile ("jsr a6@(-0x102)"
- : /* No Output */
- : "r" (a6), "r" (d0), "r" (a0), "r" (a1)
- : "d0", "d1", "a0", "a1");
- }
-
- #undef BASE_EXT_DECL
- #undef BASE_EXT_DECL0
- #undef BASE_PAR_DECL
- #undef BASE_PAR_DECL0
- #undef BASE_NAME
-
- __END_DECLS
-